package state

import androidx.compose.runtime.mutableStateListOf

/**
 * @author wei kunJie
 * @date 2024/3/7 19:53:42
 */
class ApplicationWindowsState {
    val windowTypes = mutableStateListOf<WindowType>()

    init {
        windowTypes += WindowType.LOGIN
//        windowTypes += WindowType.Phone    //调试用
    }

    fun close(window: WindowType) {
        windowTypes.remove(window)
    }

    fun isExist(window: WindowType): Boolean {
        return windowTypes.find { window == it } != null
    }

    fun newWindow(window: WindowType) {
        windowTypes += window
    }

    fun exit() {
        windowTypes.clear()
    }
}

enum class WindowType {
    LOGIN,
    HOME,
    Search,
    Setting,
    Phone
}